<?php
require("dbinit.php");

		$uid = $_POST["uid"];
		$pwd = $_POST["pwd"];
		$query = "SELECT * FROM gUserPassword where colEmail='" . $uid . "' and colPassword='" . $pwd . "'";

		$result = mysql_query($query, $link);
		mysql_close($link);
		if (mysql_num_rows($result)==1) {
			session_start();
			$_SESSION["userid"] = 	$uid;
			//echo "pass";
			header("Location: main.php");
		} else {
			$_SESSION["userid"] = null;
			//echo "false";
			header("Location: index.php");
		}
		
?>